using System;
using System.Collections.Generic;
using System.Text;
using Emlyn.Common.Data.DBUpdater;
using Emlyn.Common.Data.SqlServer.SqlManagers;

namespace Emlyn.Website.EmlynORegan.DBUpdateRules
{
    public class DUR_0040_AddTimestampsToArticles : IDBUpdaterRule
    {
        #region IDBUpdaterRule Members

        public int UpgradeFromVersion()
        {
            return 30;
        }

        public int UpgradeToVersion()
        {
            return 40;
        }

        public void PerformUpgrade()
        {
            string lAddLastChanged =
                "ALTER TABLE dbo.tblEOArticle ADD " +
                "   LastChanged datetime NOT NULL " +
                "       CONSTRAINT DF_tblEOArticle_LastChanged DEFAULT getutcdate() ";
            SqlManager.Execute(lAddLastChanged);
        }

        #endregion
    }
}
